UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xc2ty66GzHeFErwTMiRu+ORGMavMBLEdHb92sPq3zUg=' 
WHERE 
  key_id = 'b84299292d61614684b5d67663a5278ce120f913dbfed5ddf3827dc317c341df' 
  AND (
    token = 'Xc2ty66GzHeFErwTMiRu+ORGMavMBLEdHb92sPq3zUg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017