UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EspD0TNojg9CVvR9FdzaJGm2Twi8WOEAfD2GZHFr+Qs='
WHERE
key_id = 'fe442ec235239cd477d2029c0aae2ff0495a136d746c400420bfaf21563ff687'
AND (
token = 'EspD0TNojg9CVvR9FdzaJGm2Twi8WOEAfD2GZHFr+Qs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)