UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j7VqcjDxuxmtLDqmyDq5SYeSAzvFfqECsb1mYyjn04c='
WHERE
key_id = '47b9467fff50bd3215fccd3b3c9f4f24203ce1d8507447a603f2a2bb3e89ef31'
AND (
token = 'j7VqcjDxuxmtLDqmyDq5SYeSAzvFfqECsb1mYyjn04c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)