UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nUwvwfAEDCX4ecDxib6fE9TDhtKHVQKniMB2CRNwQyU='
WHERE
key_id = '7f001637c71e34f2146f894ff28dd489f2d67ba4b3eda91d4d5f196af0231465'
AND (
token = 'nUwvwfAEDCX4ecDxib6fE9TDhtKHVQKniMB2CRNwQyU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)