UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'drFbauzhWdh13rei6l3cmvV4RKr08Y2BdBsrEznkVm8='
WHERE
key_id = 'd1160c5ac55483fa7a8bced09b145063144fe5fd2e7e64b865906d5fe5a41820'
AND (
token = 'drFbauzhWdh13rei6l3cmvV4RKr08Y2BdBsrEznkVm8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)