UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dQk+MwJZbHe1n8VfWrJfHjfOykEsvrj4DhCdYNHH+oo='
WHERE
key_id = 'edc290715344c3debc5c079df27e7368f76efb4efbfef1f68a3717ccca02c3ef'
AND (
token = 'dQk+MwJZbHe1n8VfWrJfHjfOykEsvrj4DhCdYNHH+oo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)