UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a7iLygyIOkNKkKZScI2Bw9xI39b94L8bSmMg5fQgn6o='
WHERE
key_id = '4bc10f57d9a685dadd83dc7f3c0dce8313bb1dd2f65134a427603b02b966d251'
AND (
token = 'a7iLygyIOkNKkKZScI2Bw9xI39b94L8bSmMg5fQgn6o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)