UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Sgg+UYEuB8HCwJHqKv1lWQYLZpHFFuTuKFNaCsDVEM4='
WHERE
key_id = 'a009b84e3c830484caa58463e1d39c3b81fd89b1fac5b02f12c240190dcd4483'
AND (
token = 'Sgg+UYEuB8HCwJHqKv1lWQYLZpHFFuTuKFNaCsDVEM4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)