UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ndIrnKCVUUMP2cjQceCFi0EiBN0IoOeZ26NVJZmizj0=' 
WHERE 
  key_id = '30e5e8859ecc3e049345d83ca4120fb433943a6930fbd9591a7103bd2e320249' 
  AND (
    token = 'ndIrnKCVUUMP2cjQceCFi0EiBN0IoOeZ26NVJZmizj0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027