UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4mw/oQYVorKplTsX1UQUdBnn+8pD7NKWNzSJNrMKQBU='
WHERE
key_id = 'c64a404d5306caddb509dff1b22f09bf5505f182e5d4f61641b7dce8b3fb3701'
AND (
token = '4mw/oQYVorKplTsX1UQUdBnn+8pD7NKWNzSJNrMKQBU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)