UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WD+khrWJxZ/fGbQ3Qj/eJVl/fcwJICwIy7iTTnZBri0=' 
WHERE 
  key_id = '3a8ccc59bdcc170326598bc6272e52b00a4af9250a038e317a857a1732f1c76f' 
  AND (
    token = 'WD+khrWJxZ/fGbQ3Qj/eJVl/fcwJICwIy7iTTnZBri0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038