UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tdTGLZkWKFLHN7byPO+a7JCtQmxv0k/79rOv2hN/u6c=' 
WHERE 
  key_id = '8875a2337350491ef1b048849a628e9c416b893acbb9ec94c70b309c92c16962' 
  AND (
    token = 'tdTGLZkWKFLHN7byPO+a7JCtQmxv0k/79rOv2hN/u6c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036