UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rSh+Aap6t9iywo3VX1ZYIal03BjA7rvZA4nYop5w99Q='
WHERE
key_id = '945ddd3b1fc3d920e43d4977dd079c63f7168943c0d1f9e0c0115613b4e56fe0'
AND (
token = 'rSh+Aap6t9iywo3VX1ZYIal03BjA7rvZA4nYop5w99Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)