UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D/pacs+jFnKs0Dg9i59jcO9Pf31jRfsKTwUyDWIwh6I=' 
WHERE 
  key_id = 'd7354f88611c2342f4d677a0b9827ee992fce148a3cd7b3d244584536e321a75' 
  AND (
    token = 'D/pacs+jFnKs0Dg9i59jcO9Pf31jRfsKTwUyDWIwh6I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041