UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i0Opr1JfJ2AGWDwTPdL12SgDUicrN8S753JGt2Akx1Y='
WHERE
key_id = '3a12510df52626c3f2628a0217fdc19c6bbff596160bd87166dbe4d84a294517'
AND (
token = 'i0Opr1JfJ2AGWDwTPdL12SgDUicrN8S753JGt2Akx1Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)