UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9MxyO5yg9Xueb5I0v3GmJ4KCLvUGeOL4mCfeZulH/pA=' 
WHERE 
  key_id = '561db81d6949ecb1d1d3f498ae4621f3be306ff015d1282a40fbc23466a71661' 
  AND (
    token = '9MxyO5yg9Xueb5I0v3GmJ4KCLvUGeOL4mCfeZulH/pA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040