UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x0PFAP+kTa4q7AJbFOUUpbjgywqXC6kRVih54SibnkI=' 
WHERE 
  key_id = 'ac72a09267efb9f61dd4553ddfd161760f3610c3888fbf5a0360b2f354b8740a' 
  AND (
    token = 'x0PFAP+kTa4q7AJbFOUUpbjgywqXC6kRVih54SibnkI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052