UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GY0ZDdkwihnK1vOaJRrQPLdTQ+5aIWGClO+crKuEdG8='
WHERE
key_id = '419b6b2768cc95894ffe0f9f305a2e4672ce87fd40aab32133b3c8881c5a3bdc'
AND (
token = 'GY0ZDdkwihnK1vOaJRrQPLdTQ+5aIWGClO+crKuEdG8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)