UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fLp8SIWaCNYi0ugbkYNlKlxTwAHJz4z+9xPZviAZjAE='
WHERE
key_id = '504ff3b7077515a4a8531ca104dfa717946c6c89d93d5216d67f49182b441114'
AND (
token = 'fLp8SIWaCNYi0ugbkYNlKlxTwAHJz4z+9xPZviAZjAE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)