UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1cAZp1NkxPqvzuFyU+ZmsyV31jYj2FIdYUqu4qs2VDM='
WHERE
key_id = '9897d2a1742b2069d3c82483d6f4c26338c9762bfb42e9f7f8ae2391ab386788'
AND (
token = '1cAZp1NkxPqvzuFyU+ZmsyV31jYj2FIdYUqu4qs2VDM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)