UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zYX+rFSb85P84uv+uhwmPIuFOabCZ8gnoAoHBd2nCLM='
WHERE
key_id = 'fd99b8c2e0d1abbaa1093a5c0721b8144a41aeb14d18e2db9a885498c75d41f9'
AND (
token = 'zYX+rFSb85P84uv+uhwmPIuFOabCZ8gnoAoHBd2nCLM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)