UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8kc9qLu3fOuAA5tY8yw4g5ytokjTbCNyjgLKh2An5MI='
WHERE
key_id = '8cedc19e47a37ec8d68892ef0ea4b6a5123176a51c6b8e32d5d1745dee0faa56'
AND (
token = '8kc9qLu3fOuAA5tY8yw4g5ytokjTbCNyjgLKh2An5MI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)