UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '37oMhOUhbH1dCvb+Jv6ww3ZPhb8vNHDiM967OOJkXRg='
WHERE
key_id = '0c29f1a17af0fbfc37bd375fa92219ace7798453edabcbebe4463323f6d503eb'
AND (
token = '37oMhOUhbH1dCvb+Jv6ww3ZPhb8vNHDiM967OOJkXRg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)