UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jO20yEyDfQEfubDJbRk7nVqBFwoMdpLldJD7B5ubeAs='
WHERE
key_id = 'dd4dbb76db417c6e334cc74b991cde0f3067ef6e0076c0764785867201958535'
AND (
token = 'jO20yEyDfQEfubDJbRk7nVqBFwoMdpLldJD7B5ubeAs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)