UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zQj8jR0jWZs9DHIanPpg4kq4F0Z/9XE95HOeKbrfg4s='
WHERE
key_id = '581fa7afee5f715877962ad2368211c7f8370dde811692f7cbf0fb36f10bf170'
AND (
token = 'zQj8jR0jWZs9DHIanPpg4kq4F0Z/9XE95HOeKbrfg4s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)