UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/y5rDC02r2f2BMr2z55Ko/0pR5pviPP8a5Q5tAoH1hc=' 
WHERE 
  key_id = '0db4d1ce60231112952aad73703b3c58b2b59609c0e6ea4f3a8ae9af8815d2c6' 
  AND (
    token = '/y5rDC02r2f2BMr2z55Ko/0pR5pviPP8a5Q5tAoH1hc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043