UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QEPsAfp9BhneU2vqKEiTfeEQGSrjb72wg1eHRpJ9t6I='
WHERE
key_id = '177866eccb08437544700266b711dcc3e4c6790e73a866bc974739b99bf473fd'
AND (
token = 'QEPsAfp9BhneU2vqKEiTfeEQGSrjb72wg1eHRpJ9t6I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)