UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rKWfcTPYEj0kqDrYy7mmAQ0JPIebYtuuQphwl0Tyhsg=' 
WHERE 
  key_id = '651975153d99595aab53d95b9c226d12b9e75663b834b6a343d3a13ec2d9ae9a' 
  AND (
    token = 'rKWfcTPYEj0kqDrYy7mmAQ0JPIebYtuuQphwl0Tyhsg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038