UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yj89CdwPh8+/SBh7tfLxi5MKnbjG+UORlCHYvpaetVY=' 
WHERE 
  key_id = 'bc302d3947d95e0923d0cb37bc35723584ffb0ded0d8ba84b1d24a2696340a60' 
  AND (
    token = 'yj89CdwPh8+/SBh7tfLxi5MKnbjG+UORlCHYvpaetVY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047