UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6wIx5l0HQVyTu0LJp6lsJmPA8DH/4E9q69dpdvfzM2c='
WHERE
key_id = 'a4c58b31fcc236a99034df095e74dc0cefb400af71c8c1fe03d802086589b651'
AND (
token = '6wIx5l0HQVyTu0LJp6lsJmPA8DH/4E9q69dpdvfzM2c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)