UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '50U83P9mzojN5VUSe7qAEAJEmiSCk9c+6slp84e41Oo='
WHERE
key_id = '1af74f5addec3a72704b95e76c99f2a47fd812e6749b2321c57845146c5f607d'
AND (
token = '50U83P9mzojN5VUSe7qAEAJEmiSCk9c+6slp84e41Oo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)